//Page Object
import { request } from "../../request/index.js"
Page({
    data: {
        swiperList: [],
        cateslist: [],
        floorList: []
    },
    //options(Object)
    onLoad: function (options) {
        this.getSwiperList()
        this.getCatesList()
        this.getFloorList()
    },
    getSwiperList() {
        request({ url: "/home/swiperdata" })
            .then(result => {
                this.setData({
                    swiperList: result.map(v => ({ ...v, navigator_url: v.navigator_url.replace(/main/g, 'index') }))
                })
            })
    },
    getCatesList() {
        request({ url: "/home/catitems" })
            .then(result => {
                this.setData({
                    cateslist: result
                })
            })
    },
    getFloorList() {
        request({ url: "/home/floordata" })
            .then(result => {
                this.setData({
                    floorList: result
                })
            })
    }

});
